essentialsdocsfandomcom-20200214-history
Wild encounters
This page describes wild Pokémon encounters. This includes how to set up random encounters (e.g. long grass, caves), and how to modify encounters based on various factors (e.g. location). Setting wild encounters for a map The PBS file "encounters.txt" lists all the wild Pokémon encounters for each map. Each map has its own section, which begins with that map's ID number. The section is laid out in the following order: A given map can have multiple encounter methods and corresponding lists of Pokémon. However, a map's section cannot have more than one of the same encounter method. The "Cave" encounter method cannot be defined if one of "Land", "LandDay", "LandNight", "LandMorning" or "BugContest" is also defined. However, all three encounter density values are defined for all values, even though the first and second values (for tall grass and cave respectively) are mutually exclusive. Encounter method Pokémon lists Each encounter method has its own specific number of entries (lines). Each entry has a probability assigned to it, which states how likely it is for that line to be chosen for a wild encounter via that encounter method. The table below lists each encounter method, along with the number of entries required for each of them and the probabilities of those entries (in order). The probability of choosing a particular entry is that entry's probability divided by the sum of all probabilities for that encounter method. By default, the sum of probabilities for each encounter method is 100, meaning that an entry's probability also happens to be a percentage, but they don't have to sum to 100. You can have the same species in multiple different entries in a defined encounter method. For example, putting Rattata in the first three lines of the "Land" encounter method means that there will be a 50% chance of encountering a Rattata: (20 + 20 + 10) / 100. Examples 019 25,10,10 Land SENTRET,12,15 PIDGEY,12,14 RATTATA,12 RATTATA,12 RATTATA,13 RATTATA,13 RATTATA,14 RATTATA,14 RATTATA,15 RATTATA,15 RATTATA,16 RATTATA,17 This example sets the encounters for map number 19. The probability of an encounter in tall grass is 25/180 per step, and the other two encounter densities (both 10) are irrelevant because there are no encounter methods defined that would use them. There is one encounter method (Land), and the listed Pokémon (Sentret, Pidgey and Rattata) can be encountered at the given levels. The chances of encountering a particular species are as follows: * Sentret (Lv. 12-15) - 20% * Pidgey (Lv. 12-14) - 20% * Rattata (Lv. 12-17) - 60% Both Sentret and Pidgey have an equal chance of being at each of the levels in their given ranges, but Rattata does not. Because each of the entries in which Rattata is placed have their own encounter probabilities, the chance of encountering a Rattata at a given level also depends on these entry probabilities. In this case, lower levels of Rattata are more likely to be encountered, because higher levels are in the entries with lower probability. These probabilities can easily become very complicated. 011 25,10,10 PIDGEY,16 PARAS,16 PARAS,16 RATTATA,17 RATTATA,18 PIDGEY,17 RATTATA,19 RATTATA,18 PIDGEY,19 RATTATA,18 PIDGEY,20 RATTATA,20 MAGIKARP,2 GOLDEEN,3 POLIWAG,3 FEEBAS,3 FEEBAS,3 MAGIKARP,2 GOLDEEN,3 MAGIKARP,2 GOLDEEN,3 POLIWAG,3 MAGIKARP,2 GOLDEEN,3 POLIWAG,3 FEEBAS,3 FEEBAS,3 This example shows how a map can be defined with multiple encounter methods. The encounter methods here are "Land", "Water", "OldRod", "GoodRod" and "SuperRod" (highlighted). Double wild battles All wild Pokémon encounters will be single wild battles, unless the player has a partner trainer. If they do, then all wild Pokémon encounters will be double wild battles instead. In a double wild battle, Poké Balls cannot be used if both wild Pokémon are active. They can only be used if exactly 1 wild Pokémon is active (i.e. the other has fainted). After a double wild battle, all the player's party Pokémon will be fully healed (ostensibly by the partner). Modifying wild Pokémon It is possible to modify many attributes of a wild Pokémon (e.g. make it shiny, choose its gender, change its stats, moveset, etc.). See Editing a Pokémon for information on which attributes can be changed. The method described below is the best way of editing a wild Pokémon. Firstly, decide on one or more conditions under which a Pokémon should have its attribute(s) altered. In this example, the condition is Game Switch 42 being ON, but it could instead be the map, the weather, the terrain tag of the tile you're standing on, the number of Gym Badges the player has, or even an attribute of the Pokémon being encountered (such as its species or gender). There are many more possible conditions. Make sure your conditions apply only when you want them to. Secondly, look in the script section PField_EncounterModifiers. In there are a couple of examples of the code below. You may choose to add your own copies of this code into this script section, or into a new script section to keep better track of your edits. The basic code is as follows: Events.onWildPokemonCreate += proc{|sender,e| pkmn = e0 if $game_switches42 pkmn.pbLearnMove(:HIDDENPOWER) end } This example will cause all wild Pokémon to know the move Hidden Power, as long as Game Switch 42 is ON when the encounter occurs.